<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
 <%@page import="wt.doc.WTDocument" %>
 <%@page import="wt.fc.ReferenceFactory" %>
 <%@page import="wt.vc.wip.*" %>
 <%@page import="wt.httpgw.URLFactory"%>
 <%@page import="shmged.com.shlcm.utils.CmCreateDocHelper" %>
 <%@page import="java.util.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>文档信息</title>

</head>
<%
String baseUrl = new URLFactory().getBaseHREF();
String oid=request.getParameter("oid");
ReferenceFactory rf=new ReferenceFactory();
WTDocument doc=(WTDocument)rf.getReference(oid).getObject();
String title=doc.getNumber()+","+doc.getName()+","+doc.getVersionIdentifier().getValue()+"."+doc.getIterationIdentifier().getValue();
List pirmaryList=CmCreateDocHelper.getPrimaryFile(doc);
List secondaryList=CmCreateDocHelper.getSecondaryFile(doc);
String aHref="&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javaScript:void(0)\" onclick=\"addUpdateTab('','','"+oid+"')\" >修改</a>";
%>
<body>
<center>
	<div style="margin:10px 0;"></div>
	<div class="easyui-layout" style="width:1000px;height:550px;" id="treeFolders" name="treeFolders">
		
		<div data-options="region:'center',title:'<%=title %>',iconCls:'tree-file'" style="padding-left:20px">
		<div style="margin:10px 0;"></div>
			<div style="width:960px;align:center;height:150px;border:1px solid #ccc">
				<div style="margin-top:-8px;padding-left:20px;font-size:16px"><b>常规</b></div>
					<div style="padding-left:40px;padding-top:10px">
						<b>名称:</b> <%=doc.getName() %> <br/><br/>
		 				<b>状况:</b> <% boolean checkoutFlag = WorkInProgressHelper.isCheckedOut(doc); %>  <%=checkoutFlag?"已检出":"已捡入" %><br/><br/>
		 				<b>修改者:</b> <%=doc.getModifierName() %>  <br/><br/>
		 				<b>上次修改时间:</b> <%=doc.getModifyTimestamp() %> 
		 			</div>
				
			</div>
			<div style="width:960px;align:center;height:150px;border:1px solid #ccc;margin-top:10px">
				<div style="margin-top:-8px;padding-left:20px;font-size:16px"><b>系统</b></div>
					<div style="padding-left:40px;padding-top:10px">
						<div style="padding-left:10px;float:left">
										<b> 说明:</b> <%=doc.getDescription() %> <br/><br/>
										<b>上下文:</b> <%=doc.getContainer().getName() %><br/><br/>
										<b>创建者:</b> <%=doc.getCreatorName() %><br/><br/>
										<b>创建时间:</b><%=doc.getCreateTimestamp() %>
							</div>
							<div style="margin-left:30px;float:left">
						                <b>  状态: </b><%=doc.getLifeCycleState().getDisplay() %> <br/><br/>
	 					                <b> 位置:</b> <%=doc.getFolderPath() %> <br/><br/>
	 									<b> 修改者:</b> <%=doc.getModifierName() %>  <br/><br/>
	 									<b>上次修改时间:</b> <%=doc.getModifyTimestamp() %>  
						   </div>
					</div>
			</div>
			<div style="width:960px;align:center;height:75px;border:1px solid #ccc;margin-top:10px">
				<div style="margin-top:-8px;padding-left:20px;font-size:16px"><b>主要内容</b></div>
				<table width="800" align="center">
				<tr>
					<td>名称</td>
					<td>大小</td>
					<td>修改时间</td>
					<td>修改者</td>
				</tr>
					<% for(int i=0;i<pirmaryList.size();i++){
						Map map=(Map)pirmaryList.get(i);
					%>	
					<tr>
						<td><a href="javaScript:void(0)" onclick="downFile('<%=map.get("path") %>','<%=map.get("name") %>')"><%=map.get("name") %></a></td>
						<td><%=map.get("size") %></td>
						<td><%=map.get("ModifyTimes") %></td>
						<td><%=doc.getModifierName() %></td>
					</tr>
					<% 	
					} %>
				</table>
			</div>
			
			<div style="width:960px;align:center;height:75px;border:1px solid #ccc;margin-top:10px">
				<div style="margin-top:-8px;padding-left:20px;font-size:16px"><b>附件</b></div>
				<table width="800" align="center">
				<tr>
					<td>名称</td>
					<td>大小</td>
					<td>修改时间</td>
					<td>修改者</td>
				</tr>
					<% for(int i=0;i<secondaryList.size();i++){
						Map map=(Map)secondaryList.get(i);
					%>	
					<tr>
						<td><a href="javaScript:void(0)" onclick="downFile('<%=map.get("path") %>','<%=map.get("name") %>')"><%=map.get("name") %></a></td>
						<td><%=map.get("size") %></td>
						<td><%=map.get("ModifyTimes") %></td>
						<td><%=doc.getModifierName() %></td>
					</tr>
					<% 	
					} %>
				</table>
				
			</div>
		</div>
			
	
	</div>
</center>
<script type="text/javascript">

	function downFile(path,name)
	{
		var url="<%=baseUrl%>";
		window.location.href=url+"shmged/jsp/com/shlcm/documents/downFile.jsp?path="+path+"&name="+name;
	}
	//创建一个新的tab 文档信息
	function addUpdateTab(tabObj,tabId,oid){
		var defaultTabId = "cmTabs";
		if(tabId){
			defaultTabId = tabId;
		}
		var tabDefault = {
			href:pageBaseUrl+"shmged/jsp/com/shlcm/documents/updateDoc.jsp?oid="+oid,
			title:"修改文档",
			selected: true,
			closable:true
		};
		var options ;
		if(tabObj){
		    var empty = {};
			options = $.extend(empty,tabDefault,tabObj);
		}else{
			options = tabDefault;
		}
		if($('#'+defaultTabId).tabs("exists",options.title)){
			$('#'+defaultTabId).tabs('select',options.title);
		}else{
		    $('#'+defaultTabId).tabs('add',options);
		}
//		alert(tab.outerHeight()+":"+tab.innerHeight());
//	    alert("index:"+index);
		//var oldHeight = p.panel('panel').outerHeight();  
		//setHeight();
	}
	</script>
</body>
</html>


